<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>  
<%@ page import="java.sql.*" %>
<%@ taglib prefix="l" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Lite - Bootstrap Skin</title>
    
    
    <!-- Favicon -->
    <link rel="shortcut icon" href="img/favicon.ico" />
    
    <!-- CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link href="css/font-awesome.min.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    
    <!-- Google Fonts -->
    <link href='http://fonts.useso.com/css?family=Titillium+Web' rel='stylesheet' type='text/css'>

</head>

<body>

    <!-- Start: Preloader -->
    <div id="preloader">
        <div id="loader"></div>
    </div>
    <!-- End: Preloader -->

    <!-- Start: Main Content -->
    <div class="main-container">
        
        <!-- Start: Home -->
        <section class="home-section">
            <div class="container">
				<div class="row">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<h1 style="color: FFFFFF">图书商城</h1>
					</div>
				</div>
            </div>
        </section>
        <!-- End: Home -->
		
		<!-- Start: Content -->
        <section class="content-section">
            <div class="container">
				
				<div class="row">
					<div class="col-md-12" align="center">
						<h2 class="page-header"><span>管理员添加书籍</span></h2>
					</div>
					<div class="col-xs-12">
						<div class="" align="center">
							<form action="AddBook.do" method="post" enctype="multipart/form-data" name="channelform" onsubmit="return validate_channel_info(this);">
								<div class="form-group" align="center">
									<label for="bname">书名</label>
									<input type="text" name="bname" class="form-control" style="width: 300" >
									<i id="bnameId"></i>
								</div>
								<div class="form-group" align="center">
									<label for="bpicture">图片</label>
									<input type="file" name="bpicture" style="width: 300">
									<i id="bpictureId"></i>
								</div>
								<div class="form-group" align="center">
									<label for="classify">分类</label>
									<select name="classify" class="form-control" style="width: 300">
										<option selected="selected" value="计算机">计算机</option>
										<option value="语言">语言</option>
										<option value="文学">文学</option>
										<option value="军事">军事</option>
										<option value="政治">政治</option>
										<option value="法律">法律</option>
										<option value="地理">地理</option>
										<option value="摄影">摄影</option>
										<option value="美术">美术</option>
									</select>
									
									<i id="classifyId"></i>
								</div>
								<div class="form-group" align="center">
									<label for="author">作者</label>
									<input type="text" name="author" class="form-control" style="width: 300">
									<i id="authorId"></i>
								</div>
								
								<div class="form-group" align="center">
									<label for="publisher">出版商</label>
									<input type="text" name="publisher" class="form-control" style="width: 300">
									<i id="publisherId"></i>
								</div>
								<div class="form-group" align="center">
									<label for="date_publish">出版时间</label>
									<input type="text" name="date_publish" class="form-control" style="width: 300" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
									<i id="date_publishId"></i>
								</div>
								<div class="form-group" align="center">
									<label for="cost">价格</label>
									<input type="text" name="cost" class="form-control" style="width: 300">
									<i id="costId"></i>
								</div>
								<div class="form-group" align="center">
									<label for="recomlevel">推荐等级</label>
									<select name="recomlevel" class="form-control" style="width: 300">
										<option selected="selected" value="1">等级1(最低)</option>
										<option value="2">等级2</option>
										<option value="3">等级3</option>
										<option value="4">等级4</option>
										<option value="5">等级5(最高)</option>
									</select>
									<i id="recomlevelId"></i>
								</div>
								
								<br/>
								<input type="submit" class="btn btn-primary-alt" value="Submit" >
								 
							</form>
							<script type="text/javascript">  
			                    function validate_channel_info(channelform)  
			                    {  
			                        if(channelform.bname.value=="")  
			                        {  
			                            alert("请输入名字");  
			                            return false;  
			                        }  
			                        else if(channelform.bpicture.value=="")  
			                        {  
			                            alert("请添加图片");  
			                            return false;  
			                        }
			               
			                        else if(channelform.author.value=="")  
			                        {  
			                            alert("请输入作者");  
			                            return false;  
			                        }
			                        else if(channelform.publisher.value=="")  
			                        {  
			                            alert("请输入出版商");  
			                            return false;  
			                        }
			                        else if(channelform.date_publish.value=="")  
			                        {  
			                            alert("请输入出版日期");  
			                            return false;  
			                        }
			                        else if(!isNumber(channelform.cost.value)) 
			                        {  
			                            alert("请输入大于0的数");  
			                            return false;  
			                        }
			                        
			                        return true;  
			                    }   
			                      
			                    function isNumber(str)          // 判断是否为非负整数  
			                    {  
			                        var rx = /^[\+]?\d+(?:\.d+)?$/;  
			                        return rx.test(str);  
			                    } 
			                </script>  
						</div>
					</div>
				</div>
            </div>
        </section>
        <!-- End: Content -->
        
        <!-- Start: Footer-->
        <footer class="footer">
            <p>Copyright &copy; 2017.Company name All rights reserved.</p>
        </footer>
        <!-- End: Footer -->
        
    </div>
    <!-- End: Main Content -->
    
    <!-- Javascript Files -->
    <script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/jquery.pagination.js"></script>
	<script type="text/javascript" src="js/jquery.knob.min.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
   
</body>
</html>
